package com.wn55.hrms.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.wn55.hrms.entity.Leave;
import com.wn55.hrms.entity.Statistical;
import com.wn55.hrms.mapper.StatisticalMapper;
import com.wn55.hrms.service.vo.StatisticalVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author Mr.bai~
 * @version 1.0
 * @date 2022/5/6 23:07
 */
@Service
public class StatisticalService {

    @Autowired
    StatisticalMapper statisticalMapper;

    public PageInfo<StatisticalVo> queryStatistical(Integer now, Integer size, String uname) {
        PageHelper.startPage(now,size);

        List<StatisticalVo> list = statisticalMapper.selectConds(uname);
        return new PageInfo<>(list);
    }

    public void removeBykey(int id) {
        statisticalMapper.deleteByPrimaryKey(id);
    }

    public void add(Statistical statistical) {
        statisticalMapper.insertStatistical(statistical);
    }

    public void modifyStatistical(Statistical statistical) {
        statisticalMapper.updateByPrimaryKey(statistical);
    }
}
